package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswGroupGood;

@Mapper
public interface TswGroupGoodDao {

    @Select("select * from tsw_group_good t where t.id = #{id}")
    TswGroupGood getById(Long id);

    @Delete("delete from tsw_group_good where id = #{id}")
    int delete(Long id);

    int update(TswGroupGood tswGroupGood);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_group_good(product_id, specifications_id, mail_id, actual_price, purchase_price, limit_number, increase_discount, ispeople_buy, spell_discount, spell__time, return_wing, whether, sales, mall_type, universal_coupon, itemupshelf_total, total_inventory, virtual_inventory, joining_amount, group_limite, create_time, lottery_time, creater, update_time, updater, spell_note, spell_remark) values(#{productId}, #{specificationsId}, #{mailId}, #{actualPrice}, #{purchasePrice}, #{limitNumber}, #{increaseDiscount}, #{ispeopleBuy}, #{spellDiscount}, #{spellTime}, #{returnWing}, #{whether}, #{sales}, #{mallType}, #{universalCoupon}, #{itemupshelfTotal}, #{totalInventory}, #{virtualInventory}, #{joiningAmount}, #{groupLimite}, #{createTime}, #{lotteryTime}, #{creater}, #{updateTime}, #{updater}, #{spellNote}, #{spellRemark})")
    int save(TswGroupGood tswGroupGood);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswGroupGood> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
